package dialogs
{
	import UIFree.uif_component;
	
	import flash.events.MouseEvent;
	import flash.geom.Rectangle;
	import flash.text.TextField;	

	public class pi_linkDialog extends pi_alert {
		private var linkField: TextField;
		public function pi_linkDialog(parent:uif_component, link: String, descr: String='', 
										closeFunc: Function=null, eCloseFunc: Function=null, cancelButton: Boolean = false, canClose:int=2) {
			super(parent, descr?descr:(parent.app as Object).classes['data'].LINKHELP, closeFunc, cancelButton, canClose);
			
			if (eCloseFunc != null) {
				_button.addEventListener(MouseEvent.CLICK, eCloseFunc); 
			}
			
			var inner: Rectangle = getInner();
			linkField = new TextField();
			linkField.border = true;
			linkField.x = inner.x;
			linkField.y = inner.height - 40;
			linkField.height = 20;
			linkField.type = 'input';
			linkField.text = link;
			app.stage.focus = linkField;
			linkField.setSelection(0, link.length);
			linkField.width = inner.width;
			addChild(linkField);
		}
		
		public function get link(): String {
			return linkField.text;
		}
		
		override protected function resizeFromText(): Rectangle {
			var rect: Rectangle = super.resizeFromText();
			height += 30;
			rect.height += 30;
			return rect;
		}
		
	}
}